
{extend name="public/base"}
{block name="x-body"}
<style>
  .layui-form-item .layui-form-label {
    width: 10%;
  }

  .layui-form-item .layui-input-inline {
    width: 50%;
  }

  .layui-form-item .layui-disabled {
    border: none;
  }

  .user_delivery p {
    color: #d2d2d2;
  }

  .express p input {
    width: 30%;
    display: inline-block;

    margin-left: 8px;
  }

  .express p span {
    color: #d2d2d2;
  }

  .express p:last-of-type input {
    margin-top: 3px;
  }
</style>
<div class="x-body">
  <form class="layui-form">
    {if $id}
    <input type="hidden" name="id" value="{$id}">
    {/if}
    <div class="layui-form-item">
      <label  class="layui-form-label">
        订单编号
      </label>
      <div class="layui-input-inline">
        <input type="text" disabled autocomplete="off" class="layui-input layui-disabled" value="{$res.order_sn}">
      </div>
    </div>

    <div class="layui-form-item">
      <label class="layui-form-label">
        用户名称
      </label>
      <div class="layui-input-inline">
        <input type="text"
               autocomplete="off" disabled class="layui-input layui-disabled" value="{$res.username}">
      </div>
    </div>

    <div class="layui-form-item">
      <label class="layui-form-label">
        申请日期
      </label>
      <div class="layui-input-inline">
        <input type="text"
               autocomplete="off" disabled class="layui-input layui-disabled" value="{$res.addtime|date='Y-m-d H:i'}">
      </div>
    </div>

    <div class="layui-form-item">
      <label class="layui-form-label">
        商品名称
      </label>
      <div class="layui-input-inline">
        <input type="text"
               autocomplete="off" disabled class="layui-input layui-disabled" value="{$res.goods_name} （{$res.spec_key_name}）">
      </div>
    </div>

    <div class="layui-form-item">
      <label class="layui-form-label">
        服务类型
      </label>
      <div class="layui-input-inline">
        <input type="text"
               autocomplete="off" disabled class="layui-input layui-disabled" value="{if $res.type == 1}退货退款{elseif $res.type == 2 /}换货{else /}仅退款{/if}">
      </div>
    </div>

    {if $res.type != 2}
      <div class="layui-form-item">
        <label for="refund_money" class="layui-form-label">
          需退款金额
        </label>
        <div class="layui-input-inline">
          <input type="text" id="refund_money" name="refund_money"
                 autocomplete="off" class="layui-input" value="{$res.refund_money}">
        </div>
      </div>

      <div class="layui-form-item">
        <label for="refund_integral" class="layui-form-label">
          需退款积分
        </label>
        <div class="layui-input-inline">
          <input type="text" id="refund_integral" name="refund_integral"
                 autocomplete="off" class="layui-input" value="{$res.refund_integral}">
        </div>
      </div>
    {/if}


    {if $res.status != 0 && $res.type !=2}
      {if $res.type == 1}
        {if $res.status == 3}
          <div class="layui-form-item">
            <label class="layui-form-label">
              处理方式
            </label>
            <div class="layui-input-inline">
              <button class="layui-btn layui-btn-normal">支付原路返回</button>
            </div>
          </div>
        {/if}
      {else /}
        <div class="layui-form-item">
          <label class="layui-form-label">
            处理方式
          </label>
          <div class="layui-input-inline">
            <button class="layui-btn layui-btn-normal">支付原路返回</button>
          </div>
        </div>
      {/if}
    {/if}


    <div class="layui-form-item">
      <label class="layui-form-label">
        {$res.type == 2 ? '售后申请原因' : '退款原因'}
      </label>
      <div class="layui-input-inline">
        <input type="text" autocomplete="off" disabled class="layui-input layui-disabled" value="{$res.reason ? $res.reason : '无'}">
      </div>
    </div>

    <div class="layui-form-item">
      <label class="layui-form-label">
        {$res.type == 2 ? '售后申请描述' : '退款描述'}
      </label>
      <div class="layui-input-inline">
        <input type="text" autocomplete="off" disabled class="layui-input layui-disabled" value="{$res.describe ? $res.describe : '无'}">
      </div>
    </div>

    <div class="layui-form-item">
      <label class="layui-form-label">
        用户上传图片
      </label>
      <div class="layui-input-inline">

      </div>
    </div>

    {if $res.status == 0}
      <div class="layui-form-item">
        <label class="layui-form-label">审核状态</label>
        <div class="layui-input-inline">
          <input type="radio" name="status" value="1" title="审核通过" checked>
          <input type="radio" name="status" value="-1" title="拒绝通过">
        </div>
      </div>
    {else /}
      <div class="layui-form-item">
        <label class="layui-form-label">状态</label>
        <div class="layui-input-inline">
          <input type="text" autocomplete="off" disabled class="layui-input layui-disabled" value="{switch name='res.status'}{case value="-2"}用户已取消{/case}{case value="-1"}审核不通过{/case} {case value="1"}审核通过{/case} {case value="2"}已发货{/case} {case value="3"}已收货{/case} {case value="4"}换货完成{/case} {case value="5"}退款完成{/case} {/switch}">
        </div>
      </div>
    {/if}

    {if $res.status >= 2 && $res.type != 0}
    <div class="layui-form-item">
      <label class="layui-form-label">用户发货物流信息</label>
      <div class="layui-input-inline user_delivery">
        <p>快递公司：{$res.delivery.express_name ? $res.delivery.express_name : '无'}</p>
        <p>快递单号：{$res.delivery.express_sn ? $res.delivery.express_sn : '无'}</p>
        <p>发货时间：{if isset($res.delivery.express_time)}{$res.delivery.express_time|date="Y-m-d H:i"}{else /}无{/if}</p>
      </div>
    </div>
    {/if}

    <div class="layui-form-item layui-form-text">
      <label for="remark" class="layui-form-label">
        处理备注
      </label>
      <div class="layui-input-inline">
        <textarea placeholder="退货描述" id="remark" {if $res.status == 0}name="remark"{/if} class="layui-textarea"  {if $res.status != 0}disabled{/if}>{$res.remark}</textarea>
      </div>
    </div>

    {if $res.type != 0 && $res.status >= 3}
      <div class="layui-form-item">
        <label class="layui-form-label">商家发货信息</label>
        <div class="layui-input-inline express">
          <input type="hidden" name="status" value="4">
          <p>
            <span>快递公司：{$res.seller_delivery.express_name ? $res.seller_delivery.express_name : '无'}</span>
            {if !$res.seller_delivery}
            <input type="text" id="express_name" name="express_name"
                   autocomplete="off" class="layui-input" value="">
            {/if}
          </p>

          <p>
            <span>快递单号：{$res.seller_delivery.express_sn ? $res.seller_delivery.express_sn : '无'}</span>
            {if !$res.seller_delivery}
            <input type="text" id="express_sn" name="express_sn"
                   autocomplete="off" class="layui-input" value="" onfocus="isNum(this)">
            {/if}
          </p>

          {if $res.status == 4}
            <p>
              <span>发货时间：{if isset($res.seller_delivery.express_time)}{$res.seller_delivery.express_time|date="Y-m-d H:i"}{else /}无{/if}</span>
            </p>
          {/if}
        </div>
      </div>
    {/if}

    {if $res.status == 0 || $res.status == 2 || $res.status == 3}
    <div class="layui-form-item">
      <label for="L_repass" class="layui-form-label">
      </label>
      <button  class="layui-btn" lay-filter="edit" lay-submit="" id="L_repass">
        {if $res.type != 0}
          {if $res.status == 2}
            <input type="hidden" name="status" value="3">
            确认收货
          {elseif $res.status == 3}
            确认发货
          {elseif $res.status == 0}
            修改
          {/if}
        {else /}
          修改
        {/if}
      </button>
    </div>
    {/if}
  </form>
</div>
<script>
    $(function (){
        formData('{:url("orders/return_form")}', 'edit', function (){
            location.reload();
        }, false);
    })
</script>
{/block}